package com.example.administrator.acmapp.Fragment.ClassroomFragmentPage;

import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.baoyz.widget.PullRefreshLayout;
import com.example.administrator.acmapp.Adapter.ClassRoomContentListViewAdapter;
import com.example.administrator.acmapp.R;

/**
 * Created by Administrator on 2018/2/6/006.
 */

public class ClassRoomEightFragment extends Fragment {
    private ListView mContentListView;
    private View view;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.classroom_one_fragment_layout,container,false);
        initContentView();
        return view;
    }

    private void initContentView() {
        mContentListView = view.findViewById(R.id.classroom_listview_content);
        mContentListView.setAdapter(new ClassRoomContentListViewAdapter(getActivity()));
        final PullRefreshLayout layout = (PullRefreshLayout) view.findViewById(R.id.classroom_fragment_pullRefreshLayout);
        layout.setOnRefreshListener(new PullRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                // start refresh
                layout.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        layout.setRefreshing(false);
                    }
                }, 3000);
            }
        });
        layout.setColor(Color.parseColor("#7fd8bf"));
        layout.setRefreshStyle(PullRefreshLayout.STYLE_SMARTISAN);
        layout.setRefreshing(false);
    }
}
